<template>
  <div>
    <el-row>
      <mu-appbar title="我的个人信息" style="background-color:#409EFF">
        <mu-icon-button  icon="arrow_back_ios" slot="left" :to="{name: 'AboutMe' }"/>
      </mu-appbar>
    </el-row>

    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="ID">
        <el-input v-model="form.agentUid" readonly="false" size="mini"></el-input>
      </el-form-item>
      <el-form-item label="级别">
        <el-input v-model="form.levelName"  readonly="false" size="mini"></el-input>
      </el-form-item>
      <el-form-item label="姓名">
        <el-input v-model="form.realName"  readonly="false" size="mini"></el-input>
      </el-form-item>
      <el-form-item label="手机">
        <el-input v-model="form.phone"  readonly="false" size="mini"></el-input>
      </el-form-item>
      <el-form-item label="微信">
        <el-input v-model="form.wechat"  readonly="false" size="mini"></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data () {
    return {
      form: {
        agentUid: '',
        agentLevel: '',
        levelName: '',
        realName: '',
        phone: '',
        wechat: '',
        binderUid: '',
        organizer: '',
        createTime: ''
      },
      condition: {
        account: sessionStorage.getItem('account')
      }
    }
  },
  methods: {
    init () {
      this.getMe()
    },
    getMe () {
      let that = this
      this.$axios({
        method: 'get',
        url: '/api/AgentService.getMe',
        params: this.condition
      })
      .then(function (resp) {
        if (resp.data.status === 'success') {
          that.form = resp.data.data
          if (that.form.agentLevel === 1) {
            that.form.levelName = '二级代理'
          }
          if (that.form.agentLevel === 2) {
            that.form.levelName = '一级代理'
          }
          if (that.form.agentLevel === 3) {
            that.form.levelName = '总代理'
          }
          if (that.form.agentLevel === 4) {
            that.form.levelName = '运营商'
          }
          if (that.form.agentLevel === 5) {
            that.form.levelName = '白户'
          }
          if (that.form.agentLevel === 6) {
            that.form.levelName = '官方'
          }
        }
      })
    }
  },
  mounted () {
    this.init()
  }

}
</script>
